<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<%@ page import="com.scalar.chiptrack.utils.ConfigManager,java.util.ArrayList"%>

<HTML><HEAD><TITLE>ScalarSoft - ChipTrac</TITLE>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type='text/css' rel='stylesheet'>

<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>

<BODY bgcolor="ffffff" marginheight="0" marginwidth="0" topmargin=0 leftmargin=0>

<SCRIPT language="JavaScript">

function cancel()
{
    window.close();
}

function submit()
{
    var purchaseOrderLineItemNo = document.purchaseOrderSiteFrom.purchaseOrderLineItemNo.value;
    var selectedSiteID  = document.purchaseOrderSiteFrom.siteID.value;
    opener.window.document.purchaseOrderForm['purchaseOrder.purchaseOrderLineItemList[' + purchaseOrderLineItemNo + '].siteId'].value = selectedSiteID;
    window.close();
}

</SCRIPT>
<%
    String selectedSiteID = request.getParameter("selectedSiteID");
    int purchaseOrderLineItemNo = 0;

    try
    {
        purchaseOrderLineItemNo = Integer.parseInt ( request.getParameter("purchaseOrderLineItemNo"));
    }
    catch (NumberFormatException nfe)
    {
        //ignore
    }
%>
<form name="purchaseOrderSiteFrom">
<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=30>

<TABLE border="0" width="100%" bordercolor="#FFFFFF" CLASS="NArialL">
   <TR>
        <TD width='40%' ALIGN="RIGHT">Site</TD>

        <TD width='60%'>
        <input type="hidden" name="purchaseOrderLineItemNo" value="<%= purchaseOrderLineItemNo %>">
        <select name='siteID' class='txfield'>
			<option value=''>-- Select one --</option>
			<%
                ArrayList siteList = (ArrayList)request.getAttribute("siteList");
                String siteID = "";
                for( int x=0 ; x < siteList.size() ; x++ )
                {
                    siteID = (String)siteList.get(x);
                    if( siteID != null && siteID.length() > 0 )
                    {
                        if(siteID.equals(selectedSiteID))
                        {
                        %><option value="<%=siteID%>" selected ><%=siteID%></option><%
                        }
                        else
                        {
					    %><option value="<%=siteID%>"><%=siteID%></option><%
                        }
                    }
                }
			%>
        </select>
        </TD>
   </TR>
</TABLE>
<TABLE BORDER="0" WIDTH="100%">
    <TR><TD colspan="4">&nbsp;</TD></TR>
    <TR>
        <TD WIDTH="40%">&nbsp;</TD>
        <TD WIDTH="10%" align="center">
            <A href="javascript:submit()" onmouseover="window.status='Click here to Select Site ID For Purchase Order Line Item';return true" onmouseout="window.status='';return true"><IMG SRC="<%=chipTracContext%>/jsp/includes/images/save.gif" ALIGN="BOTTOM" BORDER="0"></A>
        </TD>
        <TD WIDTH="10%">
            <A href="javascript:cancel()" onmouseover="window.status='Click here to Close this window';return true" onmouseout="window.status='';return true">
            <IMG SRC="<%=chipTracContext%>/jsp/includes/images/cancel.gif" ALIGN="BOTTOM" BORDER="0"></A>
        </TD>
        <TD WIDTH="40%">&nbsp;</TD>
    </TR>
    <TR><TD colspan="4">&nbsp;</TD></TR>
</TABLE>
</form>
</HEAD>
</BODY>
</HTML>

